@include('admin.header')
<link rel="stylesheet" href="/css/dropload/dropload.css">
<style>
  .search_product {
    max-height:248px;
    overflow-y: scroll;
  }
  .search_product > .item {
    width:80px;
    margin-right:5px;
    float:left;
  }
  .search_product > .item img {
    height:80px;
  }
  .search_product > .item .name {
    height:20px;
    overflow:hidden;
  }

  .order_info {
    display: block;
    margin-top: 5px;
  }
  .line {
    border: 3px dashed #ccc;
    margin-top: 10px;
    margin-bottom: 20px;
  }
</style>

<div class="container content">
  <ul class="nav nav-tabs">
    <li class="@if($into == 0)
                active
               @endif">
      <a href="{{url('ucenter/user_transfer')}}?node_id={{$node_id}}&type={{$type}}">全部</a>
    </li>
    <li class="@if($into == 2)
                active
               @endif">
      <a href="{{url('ucenter/user_transfer')}}?node_id={{$node_id}}&type={{$type}}&into=2">转入</a>
    </li>
    <li class="@if($into == 1)
                active
               @endif">
      <a href="{{url('ucenter/user_transfer')}}?node_id={{$node_id}}&type={{$type}}&into=1">转出</a>
    </li>
  </ul>
    <div class="list">
  @foreach($data as $key => $val)
    @foreach($val['children'] as $child)
      @if($child['amount'] > 0)
          <div style="border-bottom: 1px solid #ccc;margin-bottom: 20px;">
            <div class="text-left">{{$child['remarks']}}</div>
            <div class="text-right" style="margin-top: -20px; color: #c2c2c2;">{{$child['create_time']}}</div>
            <div class="text-left" style="margin-top: 10px; color: #c2c2c2;">总余额：{{$child['balance_after']}}</div>
            <div class="text-right" style="margin-top: -20px;color: #1ABC9C;">+{{$child['amount']}}</div>
          </div>
      @else
        <div style="border-bottom: 1px solid #ccc;margin-bottom: 20px;">
            <div class="text-left">{{$child['remarks']}}</div>
            <div class="text-right" style="margin-top: -20px; color: #c2c2c2;">{{$child['create_time']}}</div>
            <div class="text-left" style="margin-top: 10px; color: #c2c2c2;">总余额：{{$child['balance_after']}}</div>
            <div class="text-right" style="margin-top: -20px;color: #1ABC9C;">{{$child['amount']}}</div>
        </div>
      @endif
    @endforeach
  @endforeach
    </div>
  <input type="hidden" name="node_id" value="{{$node_id}}" />
  <input type="hidden" name="type" value="{{$type}}" />
</div>

<script type="application/javascript" src="/js/dropload/dropload.min.js"></script>

<script>

  $(function(){
      // 页数
      var page = 1;
      // 每页展示5个
//      var size = 5;
      //用户ID号
      var node_id = $("input[name='node_id']").val();
      //获取钱包类型
      var type = $("input[name='type']").val();
      var str = '';
      // dropload
      $('.content').dropload({
          scrollArea : window,
          loadDownFn : function(me){
              page++;
              // 拼接HTML
              var result = '';
              $.ajax({
                  type: 'GET',
                  url: '/ucenter/ajax_user_transfer?node_id='+node_id+'&type='+type+'&page='+page+'&pagesize='+20,
                  dataType: 'json',
                  success: function(data){
                      var arrLen = data.length;
                      if(arrLen > 0){
                          for(var i=0; i<arrLen; i++){
                              result += '<div style="border-bottom: 1px solid #ccc;margin-bottom: 20px;">'
                                      +'<div class="text-left">'+data[i].remarks+'</div>'
                                      +'<div class="text-right" style="margin-top: -20px; color: #c2c2c2;">'+data[i].create_time+'</div>'
                                      +'<div class="text-left" style="margin-top: 10px; color: #c2c2c2;">总余额：'+data[i].balance_after+'</div>'
                                      +'<div class="text-right" style="margin-top: -20px;color: #1ABC9C;">'+data[i].amount+'</div>'
                                      + '</div>';

                          }
                          // 如果没有数据
                      }else{
                          // 锁定
                          me.lock();
                          // 无数据
                          me.noData();
                      }
                      // 为了测试，延迟1秒加载
                      setTimeout(function(){
                          // 插入数据到页面，放到最后面
                          $('.list').append(result);
                          // 每次数据插入，必须重置
                          me.resetload();
                      },1000);
                  },
                  error: function(xhr, type){
                      _alert('Ajax error!');
                      // 即使加载出错，也得重置
                      me.resetload();
                  }
              });
          }
      });
  });

</script>